a86e8ef4efcfecb72b46ceb64c37a860dbd459e0,api/src/test/java/org/openmrs/api/CohortServiceTest.java,CohortServiceTest,removePatientFromCohort_shouldSaveCohortAfterRemovingPatient,#,518
Before Change
service.addPatientToCohort(service.getCohort(2), patientToAddThenRemove);
assertTrue(service.getCohort(2).contains(patientToAddThenRemove));
service.removePatientFromCohort(service.getCohort(2), patientToAddThenRemove);
assertFalse(service.getCohort(2).contains(patientToAddThenRemove));
}
}
After Change
assertTrue(service.getCohort(2).contains(patientToAddThenRemove.getPatientId()));
service.removePatientFromCohort(service.getCohort(2), patientToAddThenRemove);
List<CohortMembership> memberList = service.getCohort(2)
.getMembers().stream()
.filter(m -> m.getPatient().getPatientId().equals(patientToAddThenRemove.getPatientId()))
.collect(Collectors.toList());
CohortMembership memberWithPatientToRemove = memberList.get(0);
assertNotNull(memberWithPatientToRemove.getEndDate());
}